package com.itany.mapper;

import com.itany.jdbc.jdbc.RowMapper;
import com.itany.pojo.Dept;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 陈华旺
 * @version 1.0
 * @date 2023年11月23日 11:51
 * @Description TODO
 */
public class DeptMapper implements RowMapper<Dept> {
    @Override
    public List<Dept> mapperRow(ResultSet resultSet) throws SQLException {
        List<Dept> list = new ArrayList<>();
        while (resultSet.next()){
            list.add( new Dept(
                    resultSet.getInt("deptno"),
                    resultSet.getString("dname"),
                    resultSet.getString("loc")
            ) );
        }
        return list;
    }
}




